/**
 * Project: metacrumbs
 * File: LocationServerResource.java
 * Type: LocationServerResource
 * Author: unmarco
 * Created: Sep 5, 2011 1:59:05 PM
 */
package org.sensolab.metacrumbs.rest;

import org.restlet.ext.json.JsonRepresentation;
import org.restlet.representation.Representation;
import org.restlet.resource.ServerResource;
import org.sensolab.metacrumbs.data.model.MetaLocation;

import com.google.appengine.api.datastore.GeoPt;

/**
 * @author unmarco
 *
 */
public class LocationServerResource extends ServerResource implements
		LocationResource {

	private static volatile MetaLocation location = 
			new MetaLocation(null, new GeoPt(45.51988f, 9.36415f), "TEST", "TEST LOCATION");
	
	/* (non-Javadoc)
	 * @see org.sensolab.metacrumbs.rest.LocationResource#store(org.sensolab.metacrumbs.data.model.MetaLocation)
	 */
	@Override
	public void store(MetaLocation store) {
		LocationServerResource.location = location;
	}

	/* (non-Javadoc)
	 * @see org.sensolab.metacrumbs.rest.LocationResource#remove()
	 */
	@Override
	public void remove() {
		location = null;
	}

	@Override
	public Representation toJson() {
		return new JsonRepresentation(location);
	}

}
